import axios from "axios";
import api from "./api_addr";
console.log(axios);
const http = axios.create({ baseURL: "http://43.139.240.31:3001" });
const http2 = axios.create({ baseURL: "https://api.mcloc.cn" });
// axios.defaults.withCredentials = true;

http.interceptors.response.use(
    function (response) {
        return response.data;
    },
    function (error) {
        return Promise.reject(error);
    }
);
export const register = (data = {}) => {
    return http.post(api.register, data);
};
export const login = (data = {}) => {
    return http.post(api.login, data);
};
export const newsDetail = (data = {}) => {
    return http.get(api.newsDetail, data);
};
export const selectComment = (data = {}) => {
    return http.get(api.selectComment, { params: data });
};
export const searchUserNickName = (data = {}) => {
    return http.get(api.searchUserNickName, { params: data });
};
export const addComment = (data = {}, option = { headers: "application/x-www-form-urlencoded" }) => {
    return http.post(api.addComment, data, option);
};
export const image_code = () => {
    return http.get(api.image_code);
};
export const send_code = (data = {}) => {
    return http.get(api.send_code, { params: data });
};
// { headers: 'application/x-www-form-urlencoded' }
export const upload_img = (data = {}, option = { headers: "application/x-www-form-urlencoded" }) => {
    return http.post(api.upload_img, data, option);
};
export const selectTokenUser = (data = {}) => {
    return http.post(api.selectTokenUser, data);
};
export const save_img = (data = {}) => {
    return http.post(api.save_img, data, { headers: "application/x-www-form-urlencoded" });
};
export const delete_img = (data = {}) => {
    return http.post(api.delete_img, data, { headers: "application/x-www-form-urlencoded" });
};
export const newsClick = (data = {}) => {
    return http.get(api.newsClick, { params: data });
};
export const newsSearch = (data = {}) => {
    return http.post(api.newsSearch, data);
};
export const newsImgList = (data = {}) => {
    return http.get(api.newsImgList, { params: data });
};
export const newsImgCom = (data = {}) => {
    return http.get(api.newsImgCom, { params: data });
};
export const hotComment = (data = {}) => {
    return http.post(api.hotComment, data);
};
export const addLike = (data = {}) => {
    return http.post(api.addLike, data);
};
export const changeLike = (data = {}) => {
    return http.post(api.changeLike, data);
};
export const newNewsList = (data = {}) => {
    return http.get(api.newNewsList, { params: data });
};
export const userCom = (data = {}) => {
    return http.get(api.userCom, { params: data });
};
export const userLike = (data = {}) => {
    return http.get(api.userLike, { params: data });
};
export const undateUserWeb = (data = {}) => {
    return http.post(api.undateUserWeb, data);
};
export const userWeb = (data = {}) => {
    return http.get(api.userWeb, { params: data });
};
export const searchNewsLike = (data = {}) => {
    return http.get(api.searchNewsLike, { params: data });
};
export const modify_msg = (data = {}) => {
    return http.post(api.modify_msg, data);
};
// http2
export const hitokoto = (data = {}) => {
    return http2.get(api.hitokoto, { params: data });
};
export const insertCollect = (data = {}) => {
    return http.post(api.insertCollect, data);
};
export const selectCollect = (data = {}) => {
    return http.post(api.selectCollect, data);
};
export const selectCollectList = (data = {}) => {
    return http.post(api.selectCollectList, data);
};
export const bannerList = (data = {}) => {
    return http.get(api.bannerList, data);
};
export const addSonComment = (data = {}, option = { headers: "application/x-www-form-urlencoded" }) => {
    return http.post(api.addSonComment, data, option);
};
export const selectSonComment = (data = {}, option = { headers: "application/x-www-form-urlencoded" }) => {
    return http.post(api.selectSonComment, data, option);
};
export const getAttention = (data = {}, option = { headers: "application/x-www-form-urlencoded" }) => {
    return http.post(api.getAttention, data, option);
};
export const selectAttention = (data = {}, option = { headers: "application/x-www-form-urlencoded" }) => {
    return http.post(api.selectAttention, data, option);
};
export const userAttention = (data = {}, option = { headers: "application/x-www-form-urlencoded" }) => {
    return http.post(api.userAttention, data, option);
};
export const attentionManDetail = (data = {}, option = { headers: "application/x-www-form-urlencoded" }) => {
    return http.post(api.attentionManDetail, data, option);
};
export const selectLike = (data = {}, option = { headers: "application/x-www-form-urlencoded" }) => {
    return http.post(api.selectLike, data, option);
};
